package cn.stylefeng.guns.modular.ws.sso.action;


import com.alibaba.fastjson.JSON;
/*import com.alibaba.fastjson.JSONObject;
import com.gdjt.util.BaseUtil;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;*/
import com.alibaba.fastjson.JSONObject;
import org.apache.http.util.EntityUtils;


import java.io.IOException;
import java.util.*;

/**
 * 商业资产平台审批状态回写
 *
 * @author fengty
 * @version 1.0
 */
public class TestAmsApprovalAction {

    /**
     * EAS配置文件名
     **/
    private static String propName = "ams";
    public static String serviceApprovalStatusUrl;
    public static String appKey;

    // 从配置文件读取初始化变量
    static {
        try {
            serviceApprovalStatusUrl = "http://127.0.0.1/rest/mgr/add";
        } catch (Exception e) {
            e.printStackTrace();
        }
    }



    public static void main(String args[]) {
        // 非提交操作不执行
        String status = "";

        String retCode = "";
        String retMsg = "";
        String Sign;
        String appKey2;
        // 只有提交流程才触发接口，退回流程不触发接口

        long timestamp = new Date().getTime(); // UTC时间戳，填"1472176902"而不是"2016-08-26 10:01:42"
        Map<String, Object> map = new HashMap<String, Object>();
        Map<String, Object> modelMap = new HashMap<String, Object>();
        map.put("deptId", "1");
        map.put("name", "1");
        map.put("account", "1");
        map.put("email", "1");
        map.put("sexName", "1");
        map.put("password", "2020-10-09");

        List list = new ArrayList();
        // 申请人
        String workcode;//工号
        String fj;//附件

       /* JSONObject jsonObj = JSONObject.fromObject(map);
        System.out.println(jsonObj);
        String postDataJson = JSON.toJSONString(jsonObj);

        // post请求返回结果
        CloseableHttpClient httpClient = HttpClients.createDefault();
        String apiUrl = TestAmsApprovalAction.serviceApprovalStatusUrl;
        HttpPost method = new HttpPost(apiUrl);

        try {
            // 解决中文乱码问题
            StringEntity entity = new StringEntity(postDataJson, "utf-8");
            entity.setContentEncoding("UTF-8");
            entity.setContentType("application/json");
            method.setEntity(entity);
            HttpResponse result = httpClient.execute(method);
            // 请求发送成功，并得到响应
            if (result.getStatusLine().getStatusCode() == 200) {
                String str = "";
                // 读取服务器返回过来的json字符串数据
                str = EntityUtils.toString(result.getEntity());
                Map returnData = JSON.parseObject(str);
                // JSONObject returnJson = JSON.parseObject(str);
                // JSONObject returndata = (JSONObject)
                // returnJson.get("data");
                retCode = (String) returnData.get("code").toString();
                retMsg = (String) returnData.get("msg").toString();



            } else {


                retCode = "-1";
                retMsg = "商业资产接口未得到响应（返回状态码不是200）";

            }
        } catch (IOException e) {
            e.printStackTrace();


            retCode = "-1";
            retMsg = "商业资产接口连接时 异常返回！" + e.toString();
        } catch (Exception e) {
            e.printStackTrace();


            retCode = "-1";
            retMsg = "商业资产其它异常" + e.toString();
        }*/

    }
}